#include "LexerUtil.h"
#include "Config.h"
QsciLexer* GetLexerByName(const QString& Ext)
{
	if( Ext == "cpp" or Ext =="c" or Ext == "h")
	{
       QsciLexer* Lexer =  new QsciLexerCPP();
       QsciAPIs* api=new QsciAPIs(Lexer);
      // api->load("/home/yang/.qnotepad/qnotepad.ctag");
       //api->load("/home/yang/qnotepad/YangEdit.cpp");
       api->prepare();
       Lexer->setAPIs(api);
       return Lexer;
	}
	else if(Ext == "java")
	{
		return new QsciLexerJava();
	}
	else if( Ext == "py")
	{
		return new QsciLexerPython();
	}
	else if(Ext == "xml")
	{
		return new QsciLexerXML();
	}
	else if(Ext == "css")
	{
		return new QsciLexerCSS();
	}
	else if(Ext == "SQL")
	{
		return new QsciLexerSQL();
	}
	else if(Ext == "js")
	{
		return new QsciLexerJavaScript();
	}
	else if(Ext == "html" or Ext == "htm")
	{
		return new QsciLexerHTML();
	}
	else if(Ext == "lua")
	{
		return new QsciLexerLua();
	}
	else if(Ext == "perl")
	{
		return new QsciLexerPerl();
	}
	else
	{
		//return new QsciLexer();
		return NULL;
	}
}

QsciLexer* GetLexerForDocument(const QString& FileName)
{
    qDebug()<<FileName;
	QString Ext = GetExt(FileName);
	return GetLexerByName(Ext);
}

